package mumu.android.animate.property;

import mumu.android.R;
import android.app.Activity;
import android.os.Bundle;
import android.view.ViewGroup.LayoutParams;
import android.view.animation.AccelerateInterpolator;
import android.view.animation.Animation;
import android.view.animation.DecelerateInterpolator;
import android.view.animation.LinearInterpolator;
import android.view.animation.RotateAnimation;
import android.view.animation.ScaleAnimation;
import android.view.animation.TranslateAnimation;
import android.widget.ImageView;

/**
 * 旋转
 * 
 * @author Administrator
 * 
 */
public class rotate extends Activity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		/**
		 * 参数1：旋转的起始角度 参数2：旋转的终止角度 参数3：旋转中心的x轴取值参照方式 参数4：中心点x轴的取值
		 * 参数5：旋转中心的y轴取值参照方式 参数6：中心点y轴的取值
		 */
		RotateAnimation animation = new RotateAnimation(0, 360, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
		animation.setDuration(1000);
		animation.setRepeatCount(-1);//-1表示不停止
		ImageView imageView = new ImageView(this);
		imageView.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
		imageView.setImageResource(R.drawable.image_indicator);
		//匀速效果
		LinearInterpolator lInterpolator=new LinearInterpolator();
		//加速效果
		AccelerateInterpolator aInterpolator=new AccelerateInterpolator();
		//减速效果
		DecelerateInterpolator dInterpolator=new DecelerateInterpolator();
		animation.setInterpolator(dInterpolator);
		imageView.startAnimation(animation);
		setContentView(imageView);
	}

}
